#!/bin/bash

# 进入项目根目录
cd "$(dirname $0)"

# 更新仓库
git pull

# 创建用户并准备需要的文件
USER=openwrt
TMP=/tmp/0217b004-11ff-11ed-99e4-000d3a8242cb
useradd -m ${USER}
rm -rf ${TMP}/
mkdir -p ${TMP}/
cp build-image.sh ${TMP}/
cp -r files/ ${TMP}/
cp tmp/config.json ${TMP}/files/etc/idnewnil/
su - ${USER} <<EOF
${TMP}/build-image.sh
EOF
